var express = require("express");
var router = express.Router();

var { data } = require("./product");
var { type } = require("./product");

// 图表
router.get("/info", function (req, res, next) {
  res.json({
    success: true,
    data: {
      sales: {
        "10-28": 20.15,
        "10-29": 24.1,
        "10-30": 24.5,
        "10-31": 23.1,
        "11-1": 27.3,
        "11-2": 26.9,
        "11-3": 25.12,
        "11-4": 22.89,
        "11-5": 29.99,
        "11-6": 30.16,
        "11-7": 33.2,
        "11-8": 33.76,
        "11-9": 49.24,
        "11-10": 51.12,
        "11-11": 68.78,
        "11-12": 27.77,
        "11-13": 20.15,
        "11-14": 22.17,
        "11-15": 26.11,
        "11-16": 24.9,
        "11-17": 22.67,
        "11-18": 27.87,
        "11-19": 19.96,
        "11-20": 20.87,
        "11-21": 23.12,
        "11-22": 24.67,
        "11-23": 29.99,
        "11-24": 25.13,
        "11-25": 30.87,
        "11-26": 31.66,
        "11-27": 28.55,
        "11-28": 29.56,
      },
      gender: {
        female: 871,
        male: 102,
      },
      age: {
        18: 10.2,
        19: 11.2,
        20: 17.1,
        21: 19.3,
        22: 24.1,
        23: 26.8,
        24: 30.2,
        25: 33.9,
        26: 40.2,
        27: 49.8,
        28: 48.4,
        29: 50.1,
        30: 46.5,
        31: 45.3,
        32: 43.1,
        33: 41.2,
        34: 40.0,
        35: 37.3,
        36: 32.1,
        37: 29.3,
        38: 22.5,
        39: 20.1,
        40: 19.5,
        41: 16.5,
        42: 14.5,
        43: 13.8,
        44: 12.5,
        45: 11.5,
        47: 10.9,
        48: 10.5,
        49: 9.7,
        other: 25.9,
      },
      data,
      type,
    },
  });
});

module.exports = router;
